# coding=utf-8
import random


#
# name = 'zhangsan'
# age = 18
#
# print (type(age))
# print (type(name))
#
#


# shi = '''
#     静夜思
# 床前明月光,疑是地上霜
# '''
# print(shi)

#
# isLogin = True
# print type(isLogin)


# userName = input()
# print(userName)


# a = input("请输入第一个数:")
# b = input("请输入第二个数:")

# print(a + b)
# print(int(a) + int(b))
# print(float(a) + float(b))

# print(bool(0))

# a = 1
# b = 2
# c = 3
# # print(a, b, c)
# print(3 / 2)
# print(3 // 2)
# print(3 ** 2)
#
# print(3 % 2)

# number = int(input("请输入一个数字:"))
# print("个位数", number % 10)
# print("十位数", number // 10 % 10)
# print("百位数", number // 100 % 10)


# print(1 and 1)
# name = 'joy'
#
# print("我是:%s" % name)


# a = 5
# print(bin(a))


# print(10 & 7)
# print(bin(-7))
# print(int(0b1000))
# print(~7)


# print(3 << 3)
# print(3 * 2**3)


# print(123 >> 1)
# print(123 >> 2)
# print(123 >> 3)
#
# print(123 // 2 ** 1)
# print(123 // 2 ** 2)
# print(123 // 2 ** 3)

#
# a = 0
# while a < 5:
#     a += 1
#     print(a)

#
# for i in range(0, 10):
#     print(i)


# a = [1, 2, 3, 4, 5]
#
# print(a[2:])
# print(a[2::2])
# print(a[:2])
# print(a[::2])
# print(a[::-2])
# print(a[2::-2])

# lists = [i for i in range(1, 10)]
# print(lists)
#
# lists = [i + 2 for i in range(1, 10)]
# print(lists)
#
# lists = [i for i in range(0, 101, 2)]
# print(lists)
#
# lists = [i for i in range(0, 101) if i % 2 == 0]
# print(lists)

# a = [i for i in range(1, 101)]
# b = a[0:3]
# b = a[3:6]
# b = a[6:9]
#
# b = [a[i:i+3] for i in range(0, len(a), 3)]
# print(b)


# def test_roc(a, b, c=1):
#     print(a)
#     print(b)
#     pass
#     print(c)
#
#
# test_roc(1, 2)


# def sum(*a):
#     for i in a:
#         print(i)
#
#
# sum(1, 2, 3, 4, 5, 5)

# def gen():
#     code = ''
#     a = "12312312313123121312312"
#     for i in range(4):
#         r = random.choice(a)
#         code += r
#     return code
#
#
# print(gen())

# def login():
#     username = input("请输入用户名:")
#     passport = input("请输入密码:")
#     if username == 'admin' and passport == '123456':
#         print("登录成功")
#     else:
#         print("登录失败")
#
#
# login()

# def login(n):
#     for i in range(n):
#         username = input("请输入用户名:")
#         passport = input("请输入密码:")
#         if username == 'admin' and passport == '123456':
#             print("登录成功")
#             break
#         else:
#             print("账号密码错误,请重试")
#     print("错误次数已经达到最大值")
#
#
# login(2)


# 判断是否整形
# def get_sum(a, b):
#     if isinstance(a, int) and isinstance(b, int):
#         print(a + b)
#     else:
#         print("非整数类型")
#
#
# get_sum(1, 2)

# def borrow_book(book, name, num=1, school='zl'):
#     print("进入{}借书系统".format(school))
#     print("{}借了{}本{}".format(name, book, num))
#
#
# borrow_book("西游记", "张三", school="福建师范大学", num=4)

# a, *b, c = 1, 2, 3, 4, 5, 6
#
# print(a)
# print(b)
# print(c)

# def sum(*a): 此时会出现装包
#     for i in a:
#         print(i)
#
#
# sum(1, 2, 3, 4, 5, 5)
# ran_list = [1, 2, 3, 4, 5, 6]
# sum(*ran_list) 此时会出现拆包

# def show_book(**kwargs):
#     print(kwargs)
#
#
# show_book(book='西游记')


# def test(*args, **kwargs):
#     print(args)
#     print(kwargs)
#
#
# test(1, 2, 3, book='123')

# print("{},{},{}".format("aa", "bb", "cc"))

# print("{name},{age},{msg}".format(name="aa", age="bb", msg="cc"))

# print("-".join(["a", "b", "c"]))

# print("abc ".ljust(2))

# def get_max_min(numbers):
#     __max = numbers[0]
#     __min = numbers[0]
#     for i in numbers:
#         if i >= __max:
#             __max = i
#         if i <= __min:
#             __min = i
#     return __max, __min
#
#
# print(get_max_min([1, 2, 3, 4, 5, -1]))
# a, b = get_max_min([1, 2, 3, 4, 5, -1])
# print(a, b)
#
# a = 300
# b = 300
#
# print(id(a))
# print(id(b))
# import sys
#
# a = 101231123
# b = a
# print(sys.getrefcount(a))
# print(sys.getrefcount(b))

# def test(n1):
#     for i in range(0, n1):
#         print(i)
#     n1 += 1
#
#
# n = 9
# test(n)
# print(n)


# l = [1, 2, 3]
#
#
# def test(l1):
#     if isinstance(l1, list):
#         for i in l1:
#             print(i)
#         l1.insert(0, 0)
#     else:
#         print("不是集合类型")
#
#
# test(l)
# print(l)


# def out_def():
#     a = 100
#
#     def inner_def():
#         b = a + 100
#         return a, b
#
#     return inner_def
#
#
# r = out_def().__name__
# print(r)


# def foo(func):
#     print("---装饰器1开始---")
#
#     def inner():
#         print("装饰器1")
#         func()
#
#     print("---装饰器1结束---")
#     return inner
#
#
# def foo2(func):
#     print("---装饰器2开始---")
#
#     def inner2():
#         print("装饰器2")
#         func()
#
#     print("---装饰器2结束---")
#     return inner2
#
#
# @foo
# @foo2
# def test():
#     print("1")
#
#
# test()

# def foo(func):
#     def wrapper(*args, **kwargs):
#         print("开始装饰")
#         if kwargs.get("city") == '北京':
#             return func(*args, **kwargs)
#         else:
#             print("除了北京其他地区咱不提供服务")
#         print("装饰结束")
#
#     return wrapper
#
#
# @foo
# def house_city(city):
#     print("开始装饰:{}(城市),有一个毛坯房".format(city))
#     return 5000
#
#
# @foo
# def house_area(area, city):
#     print("开始装饰:{}(城市),{}区有一个毛坯房".format(city, area))
#     return 5000
#
#
# print(house_area("昌平", city="北京"))
#
# print(house_city(city="北京"))


# raise 抛异常
# def test(a):
#     if a < 6:
#         raise Exception("不能小于6")
#     print(a)
#
#
# test(4)



